#  from tree import DecisionTreeRegressor
#  from sklearn import datasets
#  from sklearn.model_selection import train_test_split
#
#  x, y = datasets.load_boston(return_X_y=True)
#  x, x_t, y, y_t = train_test_split(x, y, test_size=0.3, random_state=123) 
#
#  t = DecisionTreeRegressor(ccp_alpha=0.1)
#  t.fit(x, y)
#  # t.ccp()
#  # t.post_pruning(x_t, y_t)
#  print(t.score(x_t, y_t))
#  t.show()



from tree import DecisionTreeClassifier
from sklearn import datasets
from sklearn.model_selection import train_test_split

x, y = datasets.load_iris(return_X_y=True)
x, x_t, y, y_t = train_test_split(x, y, test_size=0.2, random_state=123) 

t = DecisionTreeClassifier(ccp_alpha=0.03)
t.fit(x, y)
# t.ccp()
# t.post_pruning(x_t, y_t)
print(t.score(x_t, y_t))
t.show()
